<script src="{$this->data['baseurl']}js/multiselect.js"></script>
<script src="{$this->data['baseurl']}js/category.js"></script>
<script type="text/javascript">
var category_id	= {if $this->data['info']['con']}{$this->data['info']['con']['cid']}{else}0{/if};
var successFun=function(res){
if(res.code==200){
	alert('操作成功！');
}else{
	alert('出错了，请重新尝试！');
}
}
$(document).ready(function() { 
	var updateOptions	= {dataType:'json',error:doError,success:doSuccess}
    $('#form').ajaxForm(updateOptions); 
    
    var multiSelect		= new MultiSelect('divCategorySelect','hd_category_id',dataMultiCategory,dataAllCategory);
	multiSelect.init();
	multiSelect.select(category_id);
}); 
</script>
<div id="content">
<form id="form" action="{url('ProductRelated','SaveEdit')}" method="post">
<h3 class="title">{if $this->data['id']>0}修改{else}添加{/if}关联商品{if $this->data['id']>0} [<a href="{url('ProductRelated','Del',array('id'=>$this->data['id']))}">取消关联</a>]{/if}</h3>
<table class="admin-table">
<tr>
	<td style="width:150px"><label for="con#cid">商品类目：</label></td>
	<td>
	<span id="divCategorySelect"></span>
	<input type="hidden" name="con#cid" id="hd_category_id" value="{if $this->data['info']['con']}{$this->data['info']['con']['cid']}{else}0{/if}" />
	<span etype='error_info' class="error_info" id="con#cid_info"></span>
	</td>
</tr>
<tr>
	<td><label for="con#keyword">关&nbsp;&nbsp;键&nbsp;&nbsp;词：</label></td>
	<td>
	<input name="con#keyword" id="con#keyword" type="text" size="35" {if $this->data['info']}value="{$this->data['info']['con']['keyword']}"{/if} />
	<span etype='error_info' class="error_info" id="con#keyword_info">多个关键词之间用,分隔</span>
	</td>
</tr>
<tr>
	<td><label for="con#area">商品所在地：</label></td>
	<td>
	<input name="con#area" id="con#area" type="text" size="35" {if $this->data['info']}value="{$this->data['info']['con']['area']}"{/if} />
	<span etype='error_info' class="error_info" id="con#area_info">例如:杭州市</span>
	</td>
</tr>
<tr>
	<td><label for="con#start_price">商品价格：</label></td>
	<td>
	<input name="con#start_price" id="con#start_price" type="text" {if $this->data['info']}value="{$this->data['info']['con']['start_price']}"{/if} />
	<span etype='error_info' class="error_info" id="con#start_price_info"></span> 至 
	<input name="con#end_price" id="con#end_price" type="text" {if $this->data['info']}value="{$this->data['info']['con']['end_price']}"{/if} />
	<span etype='error_info' class="error_info" id="con#end_price_info"></span>
	</td>
</tr>
<tr>
	<td><label for="con#start_commissionRate">佣金比率：</label></td>
	<td>
	<input name="con#start_commissionRate" id="con#start_commissionRate" type="text" {if $this->data['info']}value="{$this->data['info']['con']['start_commissionRate']}"{/if} />
	<span etype='error_info' class="error_info" id="con#start_commissionRate_info"></span> 至 
	<input name="con#end_commissionRate" id="con#end_commissionRate" type="text" {if $this->data['info']}value="{$this->data['info']['con']['end_commissionRate']}"{/if} />
	<span etype='error_info' class="error_info" id="con#end_commissionRate_info">请填写乘100后的数字，如3%需填写300</span>
	</td>
</tr>
<tr>
	<td><label for="con#start_commissionNum">30天累计推广量：</label></td>
	<td>
	<input name="con#start_commissionNum" id="con#start_commissionNum" type="text" {if $this->data['info']}value="{$this->data['info']['con']['start_commissionNum']}"{/if} />
	<span etype='error_info' class="error_info" id="con#start_commissionNum_info"></span> 至 
	<input name="con#end_commissionNum" id="con#end_commissionNum" type="text" {if $this->data['info']}value="{$this->data['info']['con']['end_commissionNum']}"{/if} />
	<span etype='error_info' class="error_info" id="con#end_commissionNum_info"></span>
	</td>
</tr>
<tr>
	<td><label for="con#start_credit">卖家信用：</label></td>
	<td>
	<select name="con#start_credit">
	<option value="">请选择</option>
	<option value="1heart" {if $this->data['info']['con']['start_credit']=='1heart'}selected{/if}>一心</option>
	<option value="2heart" {if $this->data['info']['con']['start_credit']=='2heart'}selected{/if}>两心</option>
	<option value="3heart" {if $this->data['info']['con']['start_credit']=='3heart'}selected{/if}>三心</option>
	<option value="4heart" {if $this->data['info']['con']['start_credit']=='4heart'}selected{/if}>四心</option>
	<option value="5heart" {if $this->data['info']['con']['start_credit']=='5heart'}selected{/if}>五心</option>
	<option value="1diamond" {if $this->data['info']['con']['start_credit']=='1diamond'}selected{/if}>一钻</option>
	<option value="2diamond" {if $this->data['info']['con']['start_credit']=='2diamond'}selected{/if}>两钻</option>
	<option value="3diamond" {if $this->data['info']['con']['start_credit']=='3diamond'}selected{/if}>三钻</option>
	<option value="4diamond" {if $this->data['info']['con']['start_credit']=='4diamond'}selected{/if}>四钻</option>
	<option value="5diamond" {if $this->data['info']['con']['start_credit']=='5diamond'}selected{/if}>五钻</option>
	<option value="1crown" {if $this->data['info']['con']['start_credit']=='1crown'}selected{/if}>一冠</option>
	<option value="2crown" {if $this->data['info']['con']['start_credit']=='2crown'}selected{/if}>两冠</option>
	<option value="3crown" {if $this->data['info']['con']['start_credit']=='3crown'}selected{/if}>三冠</option>
	<option value="4crown" {if $this->data['info']['con']['start_credit']=='4crown'}selected{/if}>四冠</option>
	<option value="5crown" {if $this->data['info']['con']['start_credit']=='5crown'}selected{/if}>五冠</option>
	<option value="1goldencrown" {if $this->data['info']['con']['start_credit']=='1goldencrown'}selected{/if}>一黄冠</option>
	<option value="2goldencrown" {if $this->data['info']['con']['start_credit']=='2goldencrown'}selected{/if}>二黄冠</option>
	<option value="3goldencrown" {if $this->data['info']['con']['start_credit']=='3goldencrown'}selected{/if}>三黄冠</option>
	<option value="4goldencrown" {if $this->data['info']['con']['start_credit']=='4goldencrown'}selected{/if}>四黄冠</option>
	<option value="5goldencrown" {if $this->data['info']['con']['start_credit']=='5goldencrown'}selected{/if}>五黄冠</option>
	</select>
	 至 
	<select name="con#end_credit">
	<option value="">请选择</option>
	<option value="5goldencrown" {if $this->data['info']['con']['end_credit']=='5goldencrown'}selected{/if}>五黄冠</option>
	<option value="4goldencrown" {if $this->data['info']['con']['end_credit']=='4goldencrown'}selected{/if}>四黄冠</option>
	<option value="3goldencrown" {if $this->data['info']['con']['end_credit']=='3goldencrown'}selected{/if}>三黄冠</option>
	<option value="2goldencrown" {if $this->data['info']['con']['end_credit']=='2goldencrown'}selected{/if}>二黄冠</option>
	<option value="1goldencrown" {if $this->data['info']['con']['end_credit']=='1goldencrown'}selected{/if}>一黄冠</option>
	<option value="5crown" {if $this->data['info']['con']['end_credit']=='5crown'}selected{/if}>五冠</option>
	<option value="4crown" {if $this->data['info']['con']['end_credit']=='4crown'}selected{/if}>四冠</option>
	<option value="3crown" {if $this->data['info']['con']['end_credit']=='3crown'}selected{/if}>三冠</option>
	<option value="2crown" {if $this->data['info']['con']['end_credit']=='2crown'}selected{/if}>两冠</option>
	<option value="1crown" {if $this->data['info']['con']['end_credit']=='1crown'}selected{/if}>一冠</option>
	<option value="5diamond" {if $this->data['info']['con']['end_credit']=='5diamond'}selected{/if}>五钻</option>
	<option value="4diamond" {if $this->data['info']['con']['end_credit']=='4diamond'}selected{/if}>四钻</option>
	<option value="3diamond" {if $this->data['info']['con']['end_credit']=='3diamond'}selected{/if}>三钻</option>
	<option value="2diamond" {if $this->data['info']['con']['end_credit']=='2diamond'}selected{/if}>两钻</option>
	<option value="1diamond" {if $this->data['info']['con']['end_credit']=='1diamond'}selected{/if}>一钻</option>
	<option value="5heart" {if $this->data['info']['con']['end_credit']=='5heart'}selected{/if}>五心</option>
	<option value="4heart" {if $this->data['info']['con']['end_credit']=='4heart'}selected{/if}>四心</option>
	<option value="3heart" {if $this->data['info']['con']['end_credit']=='3heart'}selected{/if}>三心</option>
	<option value="2heart" {if $this->data['info']['con']['end_credit']=='2heart'}selected{/if}>两心</option>
	<option value="1heart" {if $this->data['info']['con']['end_credit']=='1heart'}selected{/if}>一心</option>
	</select>
	<span etype='error_info' class="error_info" id="con#start_credit_info"></span>
	<span etype='error_info' class="error_info" id="con#end_credit_info"></span>
	</td>
</tr>
<tr>
	<td><label for="con#sort">排&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;序：</label></td>
	<td>
	<select name="con#sort">
	<option value="">请选择</option>
	<option value="price_desc" {if $this->data['info']['con']['sort']=='price_desc'}selected{/if}>价格从高到低</option>
	<option value="price_asc" {if $this->data['info']['con']['sort']=='price_asc'}selected{/if}>价格从低到高</option>
	<option value="credit_desc" {if $this->data['info']['con']['sort']=='credit_desc'}selected{/if}>信用等级从高到低</option>
	<option value="commissionRate_desc" {if $this->data['info']['con']['sort']=='commissionRate_desc'}selected{/if}>佣金比率从高到底</option>
	<option value="commissionRate_asc" {if $this->data['info']['con']['sort']=='commissionRate_asc'}selected{/if}>佣金比率从低到高</option>
	<option value="commissionNum_desc" {if $this->data['info']['con']['sort']=='commissionNum_desc'}selected{/if}>成交量从高到低</option>
	<option value="commissionNum_asc" {if $this->data['info']['con']['sort']=='commissionNum_asc'}selected{/if}>成交量从低到高</option>
	<option value="commissionVolume_desc" {if $this->data['info']['con']['sort']=='commissionVolume_desc'}selected{/if}>总支出佣金从高到底</option>
	<option value="commissionVolume_asc" {if $this->data['info']['con']['sort']=='commissionVolume_asc'}selected{/if}>总支出佣金从低到高</option>
	<option value="delistTime_desc" {if $this->data['info']['con']['sort']=='delistTime_desc'}selected{/if}>商品下架时间从高到底</option>
	<option value="delistTime_asc" {if $this->data['info']['con']['sort']=='delistTime_asc'}selected{/if}>商品下架时间从低到高</option>
	</select>
	<span etype='error_info' class="error_info" id="con#sort_info"></span>
	</td>
</tr>
<tr>
	<td><label for="con#guarantee">是否消保商家：</label></td>
	<td>
	<input name="con#guarantee" id="con#guarantee" type="checkbox" value="true" {if $this->data['info']['con']['guarantee']=='true'}checked{/if} />
	<span etype='error_info' class="error_info" id="con#guarantee"></span>
	</td>
</tr>
<tr>
	<td></td>
	<td>
	<input id="btnAjaxSubmit" type="submit" value="保存" />&nbsp;&nbsp;
	<input  type="button" value="返回" onclick="history.back()" />
	<input name="id" type="hidden" value="{$this->data['id']}" />
	<input name="iid" type="hidden" value="{$this->data['iid']}" />
	<input name="type" type="hidden" value="{$this->data['type']}" />
	</td>
</tr>
</table>
</form>
</div>